
zz <- 'fort.14'
    dummy = scan(zz,skip=1,nlines=1,quiet=T)
    nele = dummy[1]
    cat('nele=',nele,'\n')
    nnode = dummy[2]
    cat('nnode=',nnode,'\n')
    xy = matrix(scan(zz,nlines=nnode,skip=2),ncol=4,byrow=T)[,2:3]
    ele = matrix(scan(zz,nlines=nele,skip=(2+nnode)),ncol=5,byrow=T)[,3:5] 


n=40.9; s=40.65; e=-124.1; w=-124.28

x = xy[,1]
y = xy[,2]
rm(xy)

plot(x,y,type='n',cex=.2,xlim=c(w,e),ylim=c(s,n))
for(i in 1:length(x)){
    if(any(y[ele[i,]]<n&y[ele[i,]]>s&x[ele[i,]]>w&x[ele[i,]]<e)){
        lines(x[ele[i,1:2]],y[ele[i,1:2]],lwd=.2)
        lines(x[ele[i,2:3]],y[ele[i,2:3]],lwd=.2)
        lines(x[ele[i,c(1,3)]],y[ele[i,c(1,3)]],lwd=.2)
    }
}    

points(-124.09,40.86,col='red',cex=.25)
